(0) Obligation:

Clauses:

m(X, 0, Z) :- ','(!, =(Z, X)).
m(0, Y, Z) :- ','(!, =(Z, 0)).
m(X, Y, Z) :- ','(p(X, A), ','(p(Y, B), m(A, B, Z))).
p(0, 0).
p(s(X), X).
q(X, Y, Z) :- m(X, Y, Z).
q(X, Y, Z).
=(X, X).

Query: q(g,g,a)

(1) BuiltinConflictTransformerProof (EQUIVALENT transformation)

Renamed defined predicates conflicting with built-in predicates [PROLOG].

(2) Obligation:

Clauses:

m(X, 0, Z) :- ','(!, user_defined_=(Z, X)).
m(0, Y, Z) :- ','(!, user_defined_=(Z, 0)).
m(X, Y, Z) :- ','(p(X, A), ','(p(Y, B), m(A, B, Z))).
p(0, 0).
p(s(X), X).
q(X, Y, Z) :- m(X, Y, Z).
q(X, Y, Z).
user_defined_=(X, X).

Query: q(g,g,a)

(3) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph ICLP10.

(4) Obligation:

Clauses:

mA(T83, 0, T83).
mA(0, T88, 0).
mA(s(T109), s(T114), T105) :- mA(T109, T114, T105).
qB(T20, 0, T20).
qB(T25, 0, T26).
qB(0, T31, 0).
qB(0, T41, T42).
qB(s(T66), s(T71), T62) :- mA(T66, T71, T62).
qB(T123, T124, T125).

Query: qB(g,g,a)

(5) PrologToPiTRSProof (SOUND transformation)

We use the technique of [TOCL09]. With regard to the inferred argument filtering the predicates were used in the following modes:
qB_in: (b,b,f)
mA_in: (b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

qB_in_gga(T20, 0, T20) → qB_out_gga(T20, 0, T20)
qB_in_gga(T25, 0, T26) → qB_out_gga(T25, 0, T26)
qB_in_gga(0, T31, 0) → qB_out_gga(0, T31, 0)
qB_in_gga(0, T41, T42) → qB_out_gga(0, T41, T42)
qB_in_gga(s(T66), s(T71), T62) → U2_gga(T66, T71, T62, mA_in_gga(T66, T71, T62))
mA_in_gga(T83, 0, T83) → mA_out_gga(T83, 0, T83)
mA_in_gga(0, T88, 0) → mA_out_gga(0, T88, 0)
mA_in_gga(s(T109), s(T114), T105) → U1_gga(T109, T114, T105, mA_in_gga(T109, T114, T105))
U1_gga(T109, T114, T105, mA_out_gga(T109, T114, T105)) → mA_out_gga(s(T109), s(T114), T105)
U2_gga(T66, T71, T62, mA_out_gga(T66, T71, T62)) → qB_out_gga(s(T66), s(T71), T62)
qB_in_gga(T123, T124, T125) → qB_out_gga(T123, T124, T125)

The argument filtering Pi contains the following mapping:
qB_in_gga(x1, x2, x3)  =  qB_in_gga(x1, x2)
0  =  0
qB_out_gga(x1, x2, x3)  =  qB_out_gga
s(x1)  =  s(x1)
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
mA_in_gga(x1, x2, x3)  =  mA_in_gga(x1, x2)
mA_out_gga(x1, x2, x3)  =  mA_out_gga(x3)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x4)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(6) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

qB_in_gga(T20, 0, T20) → qB_out_gga(T20, 0, T20)
qB_in_gga(T25, 0, T26) → qB_out_gga(T25, 0, T26)
qB_in_gga(0, T31, 0) → qB_out_gga(0, T31, 0)
qB_in_gga(0, T41, T42) → qB_out_gga(0, T41, T42)
qB_in_gga(s(T66), s(T71), T62) → U2_gga(T66, T71, T62, mA_in_gga(T66, T71, T62))
mA_in_gga(T83, 0, T83) → mA_out_gga(T83, 0, T83)
mA_in_gga(0, T88, 0) → mA_out_gga(0, T88, 0)
mA_in_gga(s(T109), s(T114), T105) → U1_gga(T109, T114, T105, mA_in_gga(T109, T114, T105))
U1_gga(T109, T114, T105, mA_out_gga(T109, T114, T105)) → mA_out_gga(s(T109), s(T114), T105)
U2_gga(T66, T71, T62, mA_out_gga(T66, T71, T62)) → qB_out_gga(s(T66), s(T71), T62)
qB_in_gga(T123, T124, T125) → qB_out_gga(T123, T124, T125)

The argument filtering Pi contains the following mapping:
qB_in_gga(x1, x2, x3)  =  qB_in_gga(x1, x2)
0  =  0
qB_out_gga(x1, x2, x3)  =  qB_out_gga
s(x1)  =  s(x1)
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
mA_in_gga(x1, x2, x3)  =  mA_in_gga(x1, x2)
mA_out_gga(x1, x2, x3)  =  mA_out_gga(x3)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x4)

(7) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

QB_IN_GGA(s(T66), s(T71), T62) → U2_GGA(T66, T71, T62, mA_in_gga(T66, T71, T62))
QB_IN_GGA(s(T66), s(T71), T62) → MA_IN_GGA(T66, T71, T62)
MA_IN_GGA(s(T109), s(T114), T105) → U1_GGA(T109, T114, T105, mA_in_gga(T109, T114, T105))
MA_IN_GGA(s(T109), s(T114), T105) → MA_IN_GGA(T109, T114, T105)

The TRS R consists of the following rules:

qB_in_gga(T20, 0, T20) → qB_out_gga(T20, 0, T20)
qB_in_gga(T25, 0, T26) → qB_out_gga(T25, 0, T26)
qB_in_gga(0, T31, 0) → qB_out_gga(0, T31, 0)
qB_in_gga(0, T41, T42) → qB_out_gga(0, T41, T42)
qB_in_gga(s(T66), s(T71), T62) → U2_gga(T66, T71, T62, mA_in_gga(T66, T71, T62))
mA_in_gga(T83, 0, T83) → mA_out_gga(T83, 0, T83)
mA_in_gga(0, T88, 0) → mA_out_gga(0, T88, 0)
mA_in_gga(s(T109), s(T114), T105) → U1_gga(T109, T114, T105, mA_in_gga(T109, T114, T105))
U1_gga(T109, T114, T105, mA_out_gga(T109, T114, T105)) → mA_out_gga(s(T109), s(T114), T105)
U2_gga(T66, T71, T62, mA_out_gga(T66, T71, T62)) → qB_out_gga(s(T66), s(T71), T62)
qB_in_gga(T123, T124, T125) → qB_out_gga(T123, T124, T125)

The argument filtering Pi contains the following mapping:
qB_in_gga(x1, x2, x3)  =  qB_in_gga(x1, x2)
0  =  0
qB_out_gga(x1, x2, x3)  =  qB_out_gga
s(x1)  =  s(x1)
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
mA_in_gga(x1, x2, x3)  =  mA_in_gga(x1, x2)
mA_out_gga(x1, x2, x3)  =  mA_out_gga(x3)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x4)
QB_IN_GGA(x1, x2, x3)  =  QB_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x4)
MA_IN_GGA(x1, x2, x3)  =  MA_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x4)

We have to consider all (P,R,Pi)-chains

(8) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

QB_IN_GGA(s(T66), s(T71), T62) → U2_GGA(T66, T71, T62, mA_in_gga(T66, T71, T62))
QB_IN_GGA(s(T66), s(T71), T62) → MA_IN_GGA(T66, T71, T62)
MA_IN_GGA(s(T109), s(T114), T105) → U1_GGA(T109, T114, T105, mA_in_gga(T109, T114, T105))
MA_IN_GGA(s(T109), s(T114), T105) → MA_IN_GGA(T109, T114, T105)

The TRS R consists of the following rules:

qB_in_gga(T20, 0, T20) → qB_out_gga(T20, 0, T20)
qB_in_gga(T25, 0, T26) → qB_out_gga(T25, 0, T26)
qB_in_gga(0, T31, 0) → qB_out_gga(0, T31, 0)
qB_in_gga(0, T41, T42) → qB_out_gga(0, T41, T42)
qB_in_gga(s(T66), s(T71), T62) → U2_gga(T66, T71, T62, mA_in_gga(T66, T71, T62))
mA_in_gga(T83, 0, T83) → mA_out_gga(T83, 0, T83)
mA_in_gga(0, T88, 0) → mA_out_gga(0, T88, 0)
mA_in_gga(s(T109), s(T114), T105) → U1_gga(T109, T114, T105, mA_in_gga(T109, T114, T105))
U1_gga(T109, T114, T105, mA_out_gga(T109, T114, T105)) → mA_out_gga(s(T109), s(T114), T105)
U2_gga(T66, T71, T62, mA_out_gga(T66, T71, T62)) → qB_out_gga(s(T66), s(T71), T62)
qB_in_gga(T123, T124, T125) → qB_out_gga(T123, T124, T125)

The argument filtering Pi contains the following mapping:
qB_in_gga(x1, x2, x3)  =  qB_in_gga(x1, x2)
0  =  0
qB_out_gga(x1, x2, x3)  =  qB_out_gga
s(x1)  =  s(x1)
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
mA_in_gga(x1, x2, x3)  =  mA_in_gga(x1, x2)
mA_out_gga(x1, x2, x3)  =  mA_out_gga(x3)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x4)
QB_IN_GGA(x1, x2, x3)  =  QB_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x4)
MA_IN_GGA(x1, x2, x3)  =  MA_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x4)

We have to consider all (P,R,Pi)-chains

(9) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 3 less nodes.

(10) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

MA_IN_GGA(s(T109), s(T114), T105) → MA_IN_GGA(T109, T114, T105)

The TRS R consists of the following rules:

qB_in_gga(T20, 0, T20) → qB_out_gga(T20, 0, T20)
qB_in_gga(T25, 0, T26) → qB_out_gga(T25, 0, T26)
qB_in_gga(0, T31, 0) → qB_out_gga(0, T31, 0)
qB_in_gga(0, T41, T42) → qB_out_gga(0, T41, T42)
qB_in_gga(s(T66), s(T71), T62) → U2_gga(T66, T71, T62, mA_in_gga(T66, T71, T62))
mA_in_gga(T83, 0, T83) → mA_out_gga(T83, 0, T83)
mA_in_gga(0, T88, 0) → mA_out_gga(0, T88, 0)
mA_in_gga(s(T109), s(T114), T105) → U1_gga(T109, T114, T105, mA_in_gga(T109, T114, T105))
U1_gga(T109, T114, T105, mA_out_gga(T109, T114, T105)) → mA_out_gga(s(T109), s(T114), T105)
U2_gga(T66, T71, T62, mA_out_gga(T66, T71, T62)) → qB_out_gga(s(T66), s(T71), T62)
qB_in_gga(T123, T124, T125) → qB_out_gga(T123, T124, T125)

The argument filtering Pi contains the following mapping:
qB_in_gga(x1, x2, x3)  =  qB_in_gga(x1, x2)
0  =  0
qB_out_gga(x1, x2, x3)  =  qB_out_gga
s(x1)  =  s(x1)
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
mA_in_gga(x1, x2, x3)  =  mA_in_gga(x1, x2)
mA_out_gga(x1, x2, x3)  =  mA_out_gga(x3)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x4)
MA_IN_GGA(x1, x2, x3)  =  MA_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains

(11) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(12) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

MA_IN_GGA(s(T109), s(T114), T105) → MA_IN_GGA(T109, T114, T105)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
MA_IN_GGA(x1, x2, x3)  =  MA_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains

(13) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(14) Obligation:

Q DP problem:
The TRS P consists of the following rules:

MA_IN_GGA(s(T109), s(T114)) → MA_IN_GGA(T109, T114)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(15) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • MA_IN_GGA(s(T109), s(T114)) → MA_IN_GGA(T109, T114)
    The graph contains the following edges 1 > 1, 2 > 2

(16) YES